package structure.adapter;

import java.util.concurrent.Callable;

/**
 * @author lzp
 * @Date:2023/2/24
 * @description: 将callable的实现类适配为 runnable的实现类
 */
public class RunnableAdapter implements Runnable {

	private Callable<?> callable;

	public RunnableAdapter(Callable<?> callable) {
		this.callable = callable;
	}

	@Override
	public void run() {
		try {
			callable.call();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
}
